package com.jack.lib.net

import com.jack.lib.core.net.*

/**
 * author : chong.huang
 * create : 2022/3/22
 * desc   :
 */
interface IParam<T, J: JBaseData<T>> {

    fun onSuccess(onNext: ((T?) -> Unit)): IParam<T, J>

    fun onFailed(onFail: ((J) -> Unit)): IParam<T, J>

    fun onError(onError: ((cause: Throwable) -> Unit)): IParam<T, J>

    fun onComplete(onComplete: (() -> Unit)): IParam<T, J>

    fun onCancel(onCancel: (() -> Unit)): IParam<T, J>

    fun loadingMode(loadingMode: NetLoadingMode): IParam<T, J>

    fun dispatchMode(dispatchMode: NetDispatchMode): IParam<T, J>

    fun cacheMode(cacheMode: NetCacheStrategy): IParam<T, J>

    fun catchError(): IParam<T, J>

    suspend fun get(): NetResult<T, J>
}